//定义变量
const state = {
	count: 0, //计数
}

//获取
var getters = {
	doubleCount(state) {
		return state.count * 2
	}
}

//设置
const mutations = {
	increment(state) {
		state.count++
	}
}

//异步
const actions = {
	//val：传值
	asyncIncrement(context, val) {
		setTimeout(() => {
			context.commit('increment')
		}, 1000)
	}
}



export default {
	namespaced: true,
	state,
	getters,
	actions,
	mutations,
}